﻿using System.Data;

namespace Pvax.Data.Tests
{
    /// <summary>
    /// Base class for SQL-based tests
    /// </summary>
    public abstract class TestBase
    {
        /// <summary>
        /// Provides a shortcut to execute an SQL query.
        /// </summary>
        /// <param name="connection">The database connection.</param>
        /// <param name="sql">The command to execute.</param>
        protected static void ExecuteSql(IDbConnection connection, string sql)
        {
            using(var command = connection.CreateCommand())
            {
                command.CommandText = sql;
                command.ExecuteNonQuery();
            }
        }
    }
}
